package com.service.jkt.impl;

import com.dao.CheckerDao;
import com.dao.ServiceDao;
import com.entity.Checker;
import com.entity.Service;
import com.service.jkt.ShenService;
import com.util.gzp.AjaxResponse;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@org.springframework.stereotype.Service
public class ShenServiceImpl implements ShenService {
    @Resource
    private CheckerDao checkerDao;
    @Resource
    private ServiceDao serviceDao;

    @Override
    @Transactional
    public AjaxResponse shenHe(Checker checker) {
        checkerDao.insertSelective(checker);
        Service ser = new Service();
        ser.setServiceid(checker.getServiceid());
        ser.setServicestatusid(6);
        serviceDao.updateByPrimaryKeySelective(ser);
        return AjaxResponse.success(true,"success");
    }

    @Override
    @Transactional
    public AjaxResponse shenpi(Checker checker) {
        checkerDao.updateByPrimaryKey(checker);
        Service ser = new Service();
        ser.setServiceid(checker.getServiceid());
        ser.setServicestatusid(3);
        serviceDao.updateByPrimaryKeySelective(ser);
        return AjaxResponse.success(true,"success");
    }
}
